package com.dfbz.demo01;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo06_异常的抛出 {
    public static void main(String[] args) {

        try {
            method(null);
        } catch (Exception e) {
            e.printStackTrace();
        }

        System.out.println(".....");
    }


    public static void method(String str) {

        if (str == null) {
            // 自己抛出的异常,也会造成程序终止
            throw new ClassCastException("出现空指针异常啦！");
        }

        System.out.println(str);
    }
}
